using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

using GonzalesCore.CoreElements;
using GonzalesCore.CoreManagers;
using Kypris2.CoreElements;
using Kypris2.Utils;
using Jamila2.Tools;

public partial class GonzalesCCImport : System.Web.UI.Page
{
    #region Variables
    protected PrivateLoginSession CurrentPrivateSession = null;
    protected LogManager CurLogManager = null;
    protected int counter = 1;

    #region ResultTable
    protected DataTable ResultTable
    {
        get
        {
            return (DataTable)ViewState[GonzalesCommonNamingConvention.CurrentPrivateSessionViewState];
        }

        set
        {
            ViewState[GonzalesCommonNamingConvention.CurrentPrivateSessionViewState] = value;
        }
    }
    #endregion

    #region ClaimInternalID
    protected string ClaimInternalID
    {
        get
        {
            return ViewState["ClaimInternalID"].ToString();
        }

        set
        {
            ViewState["ClaimInternalID"] = value;
        }
    }
    #endregion

    #region No
    protected string No
    {
        get
        {
            string text = (string)ViewState["No"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["No"] = value;
        }
    }
    #endregion

    #region Date
    protected string Date
    {
        get
        {
            string text = (string)ViewState["Date"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["Date"] = value;
        }
    }
    #endregion

    #region Description
    protected string Description
    {
        get
        {
            string text = (string)ViewState["Description"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["Description"] = value;
        }
    }
    #endregion

    #region Currency
    protected string Currency
    {
        get
        {
            string text = (string)ViewState["Currency"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["Currency"] = value;
        }
    }
    #endregion

    #region Amount
    protected string Amount
    {
        get
        {
            string text = (string)ViewState["Amount"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["Amount"] = value;
        }
    }
    #endregion

    #region ExRate
    protected string ExRate
    {
        get
        {
            string text = (string)ViewState["ExRate"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["ExRate"] = value;
        }
    }
    #endregion

    #region FinalCurrency
    protected string FinalCurrency
    {
        get
        {
            string text = (string)ViewState["FinalCurrency"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["FinalCurrency"] = value;
        }
    }
    #endregion

    #region FinalAmount
    protected string FinalAmount
    {
        get
        {
            string text = (string)ViewState["FinalAmount"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["FinalAmount"] = value;
        }
    }
    #endregion

    #region RejectedMessage
    protected string RejectedMessage
    {
        get
        {
            string text = (string)ViewState["RejectedMessage"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["RejectedMessage"] = value;
        }
    }
    #endregion

    #region ClaimIDMessage
    protected string ClaimIDMessage
    {
        get
        {
            string text = (string)ViewState["ClaimIDMessage"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["ClaimIDMessage"] = value;
        }
    }
    #endregion

    #region DraftMessage
    protected string DraftMessage
    {
        get
        {
            string text = (string)ViewState["DraftMessage"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["DraftMessage"] = value;
        }
    }
    #endregion

    #region PurposeMessage
    protected string PurposeMessage
    {
        get
        {
            string text = (string)ViewState["PurposeMessage"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["PurposeMessage"] = value;
        }
    }
    #endregion

    #region CreatedMessage
    protected string CreatedMessage
    {
        get
        {
            string text = (string)ViewState["CreatedMessage"];
            if (text != null)
                return text;
            else
                return string.Empty;
        }

        set
        {
            ViewState["CreatedMessage"] = value;
        }
    }
    #endregion

    #endregion

    #region Events

    #region Page_Load
    protected void Page_Load(object sender, EventArgs e)
    {
        this.SessionCheck();

        if (!IsPostBack)
        {
            this.SwitchLanguage();
            this.PageComponentSetup();


            // load the data for the first time
            // loading of data will built up ResultTable
            this.LoadData();
        }

        // every page load, need to re-built the table
        this.BuiltTable();

        // every page load, need to re-built the row
        // the data row will built on the first load
        if (this.ResultTable != null)
        {
            // sort
            DataRow[] ResultRows = this.ResultTable.Select("", this.DropDownList_SortBy.SelectedValue + " " + this.DropDownList_SortOrder.SelectedValue);

            foreach (DataRow CreditCardItemRow in ResultRows)
            {
                this.BuiltRow(CreditCardItemRow);
            }
        }
    }
    #endregion 

    #region Button_Next_Click
    protected void Button_Next_Click(object sender, EventArgs e)
    {
        if (this.SaveDataAndTransferData())
        {
            Response.Redirect("GonzalesMyDraftDetail.aspx?id=" + this.ClaimInternalID);
        }

    }
    #endregion

    #region Button_Cancel_Click
    protected void Button_Cancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("GonzalesMyDraftDetail.aspx?id=" + this.ClaimInternalID);
    }
    #endregion

    #region Button_Merge_Click
    protected void Button_Merge_Click(object sender, EventArgs e)
    {
        

    }
    #endregion

    #region ImageDuplicate_Click
    void ImageDuplicate_Click(object sender, ImageClickEventArgs e)
    {
        
    }
    #endregion

    #endregion

    #region Customized Methods

    #region SessionCheck
    public void SessionCheck()
    {

        if (Session[GonzalesCommonNamingConvention.CurrentPrivateSession] != null)
        {
            this.CurrentPrivateSession = (PrivateLoginSession)Session[GonzalesCommonNamingConvention.CurrentPrivateSession];
            this.CurLogManager = new LogManager(this.CurrentPrivateSession);    // activate Log Manager
        }
        else
        {
            Response.Redirect(GonzalesErrorPageRedirect.SessionError);
        }

    }
    #endregion

    #region PageComponentSetup
    protected void PageComponentSetup()
    {

        
    }
    #endregion

    #region SwitchLanguage
    protected void SwitchLanguage()
    {
        try
        {
            using (MultiLingualFactory CurLanguageFactory = MultiLingualEngine.GetMultiLingualFactory(this, this.CurrentPrivateSession.CurrentLoggedOnUser.PreferedLanguage.InternalID))
            {
                this.Label_Information.Text = CurLanguageFactory.DisplayValue("Information");
                this.Label_PageTitle.Text = CurLanguageFactory.DisplayValue("PageTitle");
                this.Label_Remarks.Text = CurLanguageFactory.DisplayValue("Remarks");
                this.Button_Cancel.Text = CurLanguageFactory.DisplayValue("Cancel");
                this.Button_Next.Text = CurLanguageFactory.DisplayValue("Next");

                this.No = CurLanguageFactory.DisplayValue("No");
                this.Date = CurLanguageFactory.DisplayValue("Date");
                this.Description = CurLanguageFactory.DisplayValue("Description");
                this.Currency = CurLanguageFactory.DisplayValue("Currency");
                this.Amount = CurLanguageFactory.DisplayValue("Amount");
                this.ExRate = CurLanguageFactory.DisplayValue("ExRate");
                this.FinalCurrency = CurLanguageFactory.DisplayValue("FinalCurrency");
                this.FinalAmount = CurLanguageFactory.DisplayValue("FinalAmount");
                this.RejectedMessage = CurLanguageFactory.DisplayValue("RejectedMessage");
                this.ClaimIDMessage = CurLanguageFactory.DisplayValue("ClaimIDMessage");
                this.DraftMessage = CurLanguageFactory.DisplayValue("DraftMessage");
                this.PurposeMessage = CurLanguageFactory.DisplayValue("PurposeMessage");
                this.CreatedMessage = CurLanguageFactory.DisplayValue("CreatedMessage");

                this.DropDownList_SortBy.Items.Add(new ListItem(CurLanguageFactory.DisplayValue("Date"), "TransDate"));
                this.DropDownList_SortBy.Items.Add(new ListItem(CurLanguageFactory.DisplayValue("Description"), "Description"));
                this.DropDownList_SortBy.Items.Add(new ListItem(CurLanguageFactory.DisplayValue("Currency"), "SpentCurrency"));
                this.DropDownList_SortBy.Items.Add(new ListItem(CurLanguageFactory.DisplayValue("Amount"), "SpentAmount"));
                this.DropDownList_SortBy.Items.Add(new ListItem(CurLanguageFactory.DisplayValue("ExRate"), "ExchangeRate"));
                this.DropDownList_SortBy.Items.Add(new ListItem(CurLanguageFactory.DisplayValue("FinalCurrency"), "FinalCurrency"));
                this.DropDownList_SortBy.Items.Add(new ListItem(CurLanguageFactory.DisplayValue("FinalAmount"), "FinalAmount"));


                this.DropDownList_SortOrder.Items.Add(new ListItem(CurLanguageFactory.DisplayValue("ASC"), "ASC"));
                this.DropDownList_SortOrder.Items.Add(new ListItem(CurLanguageFactory.DisplayValue("DESC"), "DESC"));

            }
        }
        catch (Exception ex)
        {
            this.CurLogManager.LogError("[GonzalesCCImport.SwitchLanguage.EX] : " + ex.Message, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);
        }

    }
    #endregion

    #region BuiltTable
    protected void BuiltTable()
    {
        // add all the table header
        TableRow HeaderRow = new TableRow();

        for (int x = 0; x < 11; x++)
        {
            HeaderRow.Cells.Add(new TableCell());
            HeaderRow.Cells[x].CssClass = "GridViewHeader";
        }
        HeaderRow.Cells[0].Text = ""; HeaderRow.Cells[0].HorizontalAlign = HorizontalAlign.Center;  // select
        HeaderRow.Cells[1].Text = this.No; HeaderRow.Cells[1].HorizontalAlign = HorizontalAlign.Center;  // select
        HeaderRow.Cells[2].Text = this.Date; HeaderRow.Cells[2].HorizontalAlign = HorizontalAlign.Center;
        HeaderRow.Cells[3].Text = this.Description;
        HeaderRow.Cells[4].Text = this.Currency; HeaderRow.Cells[4].HorizontalAlign = HorizontalAlign.Center;
        HeaderRow.Cells[5].Text = this.Amount; HeaderRow.Cells[5].HorizontalAlign = HorizontalAlign.Center;
        HeaderRow.Cells[6].Text = this.ExRate; HeaderRow.Cells[6].HorizontalAlign = HorizontalAlign.Center;
        HeaderRow.Cells[7].Text = this.FinalCurrency; HeaderRow.Cells[7].HorizontalAlign = HorizontalAlign.Center; 
        HeaderRow.Cells[8].Text = this.FinalAmount; HeaderRow.Cells[8].HorizontalAlign = HorizontalAlign.Center;
        HeaderRow.Cells[9].Text = ""; HeaderRow.Cells[9].HorizontalAlign = HorizontalAlign.Center;  // attached to
        //HeaderRow.Cells[8].Text = ""; HeaderRow.Cells[8].HorizontalAlign = HorizontalAlign.Center;  // select
        HeaderRow.Cells[10].Text = ""; HeaderRow.Cells[10].HorizontalAlign = HorizontalAlign.Center;  // duplicate    
        HeaderRow.Cells[10].Visible = false;

        this.Table_CreditCardGrid.Rows.Add(HeaderRow);


    }
    #endregion

    #region BuiltRow
    protected void BuiltRow(DataRow CreditCardItemRow)
    {
        bool CreditCardItemAvailable = true;

        TableRow ItemRow = new TableRow();
        ItemRow.ID = CreditCardItemRow["InternalID"].ToString();

        for (int x = 0; x < 11; x++)
        {
            ItemRow.Cells.Add(new TableCell());
            ItemRow.Cells[x].CssClass = "GridViewItem";
        }
        // Date
        ItemRow.Cells[2].Text = CreditCardItemRow["TransDateInString"].ToString();
        ItemRow.Cells[2].HorizontalAlign = HorizontalAlign.Center;
        ItemRow.Cells[2].Width = new Unit(100);

        // Description
        ItemRow.Cells[3].Text = CreditCardItemRow["Description"].ToString();

        // Currency
        ItemRow.Cells[4].Text = CreditCardItemRow["SpentCurrency"].ToString();
        ItemRow.Cells[4].HorizontalAlign = HorizontalAlign.Center;
        ItemRow.Cells[4].Width = new Unit(100);

        // Amount Spent
        ItemRow.Cells[5].Text = CreditCardItemRow["SpentAmount"].ToString();
        ItemRow.Cells[5].HorizontalAlign = HorizontalAlign.Center;
        ItemRow.Cells[5].Width = new Unit(100);

        // Exchange Rate
        ItemRow.Cells[6].Text = CreditCardItemRow["ExchangeRate"].ToString();
        ItemRow.Cells[6].HorizontalAlign = HorizontalAlign.Center;
        ItemRow.Cells[6].Width = new Unit(100);

        // Final Currency
        ItemRow.Cells[7].Text = CreditCardItemRow["FinalCurrency"].ToString();
        ItemRow.Cells[7].HorizontalAlign = HorizontalAlign.Center;
        ItemRow.Cells[7].Width = new Unit(100);

        // Final Amount
        ItemRow.Cells[8].Text = CreditCardItemRow["FinalAmount"].ToString();
        ItemRow.Cells[8].HorizontalAlign = HorizontalAlign.Center;
        ItemRow.Cells[8].Width = new Unit(100);


        // Attached to...        

        using (ClaimManager CurClaimManager = new ClaimManager(this.CurrentPrivateSession))
        {
            if (CreditCardItemRow["ClaimHeaderID"].ToString().Length == 36)
            {
                GonzalesClaimHeader CurClaimHeader = CurClaimManager.GetClaimByInternalID(CreditCardItemRow["ClaimHeaderID"].ToString());

                if (CurClaimHeader != null)
                {
                    StringBuilder MessageBuilder = new StringBuilder("");

                    if (CurClaimHeader.Status == GonzalesClaimHeader.TypeOfClaimStatus.RejectedByApprover || CurClaimHeader.Status == GonzalesClaimHeader.TypeOfClaimStatus.RejectedByAuthorizer || CurClaimHeader.Status == GonzalesClaimHeader.TypeOfClaimStatus.RejectedByFinance)
                    {
                        CreditCardItemAvailable = true;

                        MessageBuilder.AppendLine(this.RejectedMessage);
                        MessageBuilder.AppendLine();
                        MessageBuilder.AppendLine(this.ClaimIDMessage + CurClaimHeader.ClaimID);
                    }
                    else
                    {
                        CreditCardItemAvailable = false;

                        MessageBuilder.AppendLine(this.DraftMessage);
                        MessageBuilder.AppendLine();
                    }
                    
                    MessageBuilder.AppendLine(this.PurposeMessage + CreditCardItemRow["ClaimHeaderReason"].ToString());
                    MessageBuilder.AppendLine(this.CreatedMessage + CreditCardItemRow["ClaimHeaderCreatedInString"].ToString());

                    Image ImageOtherClaim = new Image();
                    ImageOtherClaim.ImageUrl = GonzalesImages.Icon_Remarks;
                    ImageOtherClaim.ToolTip = MessageBuilder.ToString();
                    ImageOtherClaim.Attributes["onClick"] = "alert(this.title); return false;";

                    ItemRow.Cells[9].Controls.Add(ImageOtherClaim);

                }
            }
        }
        
        ItemRow.Cells[9].HorizontalAlign = HorizontalAlign.Center;
        ItemRow.Cells[9].Width = new Unit(20);

        // Selected

        if (CreditCardItemAvailable || (CreditCardItemRow["ClaimHeaderID"].ToString().CompareTo(this.ClaimInternalID) == 0))
        {
            CheckBox CheckBoxSelected = new CheckBox();
            CheckBoxSelected.ID = ItemRow.ID + "_CheckBoxSelected";
            CheckBoxSelected.Checked = (CreditCardItemRow["ClaimHeaderID"].ToString().CompareTo(this.ClaimInternalID) == 0);            

            ItemRow.Cells[0].Controls.Add(CheckBoxSelected);
            ItemRow.Cells[0].HorizontalAlign = HorizontalAlign.Center;
            ItemRow.Cells[0].Width = new Unit(20);
        }

        // No.
        ItemRow.Cells[1].Text = Convert.ToString(counter++);
        ItemRow.Cells[1].HorizontalAlign = HorizontalAlign.Center;
        ItemRow.Cells[1].Width = new Unit(20);

        // duplicate

        ImageButton ImageDuplicate = new ImageButton();
        ImageDuplicate.ImageUrl = GonzalesImages.Icon_Expand;
        ImageDuplicate.ID = CreditCardItemRow["InternalID"].ToString() + "_ImageDuplicate";
        ImageDuplicate.Visible = CreditCardItemAvailable;
        ImageDuplicate.Click += new ImageClickEventHandler(ImageDuplicate_Click);

        HiddenField HiddenFieldItemAvailable = new HiddenField();
        HiddenFieldItemAvailable.ID = CreditCardItemRow["InternalID"].ToString() + "_HiddenFieldItemAvailable";
        HiddenFieldItemAvailable.Value = (CreditCardItemAvailable) ? "1" : "0";

        ItemRow.Cells[10].Controls.Add(ImageDuplicate);
        ItemRow.Cells[10].Controls.Add(HiddenFieldItemAvailable);
        ItemRow.Cells[10].HorizontalAlign = HorizontalAlign.Center;
        ItemRow.Cells[10].Width = new Unit(20);
        ItemRow.Cells[10].Visible = false;


        // final
        this.Table_CreditCardGrid.Rows.Add(ItemRow);
    }



    #endregion

    #region ShowErrorMessage
    protected void ShowErrorMessage(string ErrorMessage)
    {
        this.Table_MessageBox.Visible = true;
        this.Table_MessageBox.Rows[0].Cells[0].Text = ErrorMessage;
    }
    #endregion

    #endregion

    #region Data Operation

    #region LoadData
    public void LoadData()
    {
        if (Request.QueryString["id"] != null && Request.QueryString["id"].Length == 36)
        {
            this.ClaimInternalID = Request.QueryString["id"];

            using (CreditCardManager CurCreditCardManager = new CreditCardManager(this.CurrentPrivateSession))
            {
                CreditCardItems CurCreditCardItems = CurCreditCardManager.GetAvailableItemsByEmployee(this.CurrentPrivateSession.CurrentLoggedOnUser.EmployeeID);

                if (CurCreditCardItems != null)
                {
                    // buiilt a Data Table first
                    // the Data Table will stored in View State memory
                    this.ResultTable = new DataTable();

                    ResultTable.Columns.Add(new DataColumn("InternalID", Type.GetType("System.String")));
                    ResultTable.Columns.Add(new DataColumn("TransDate", Type.GetType("System.DateTime")));
                    ResultTable.Columns.Add(new DataColumn("TransDateInString", Type.GetType("System.String")));
                    ResultTable.Columns.Add(new DataColumn("Description", Type.GetType("System.String")));
                    ResultTable.Columns.Add(new DataColumn("SpentCurrency", Type.GetType("System.String")));
                    ResultTable.Columns.Add(new DataColumn("SpentAmount", Type.GetType("System.Decimal")));
                    ResultTable.Columns.Add(new DataColumn("ExchangeRate", Type.GetType("System.Decimal")));
                    ResultTable.Columns.Add(new DataColumn("FinalCurrency", Type.GetType("System.String")));
                    ResultTable.Columns.Add(new DataColumn("FinalAmount", Type.GetType("System.Decimal")));
                    ResultTable.Columns.Add(new DataColumn("ClaimHeaderID", Type.GetType("System.String")));
                    ResultTable.Columns.Add(new DataColumn("ClaimHeaderReason", Type.GetType("System.String")));
                    ResultTable.Columns.Add(new DataColumn("ClaimHeaderCreatedOn", Type.GetType("System.DateTime")));
                    ResultTable.Columns.Add(new DataColumn("ClaimHeaderCreatedInString", Type.GetType("System.String")));
                    
                    

                    DataRow RowObj = null;

                    foreach (CreditCardItem CurItem in CurCreditCardItems)
                    {
                        RowObj = this.ResultTable.NewRow();

                        RowObj["InternalID"] = CurItem.InternalID;
                        RowObj["TransDate"] = CurItem.TransactionDate;
                        RowObj["TransDateInString"] = SwissArmy.DateConvert(CurItem.TransactionDate, this.CurrentPrivateSession.DateFormatInUse, "/");
                        RowObj["Description"] = CurItem.Description;
                        RowObj["SpentCurrency"] = CurItem.SpentCurrency.DisplayName;
                        RowObj["SpentAmount"] = CurItem.SpentAmount;
                        RowObj["ExchangeRate"] = CurItem.ExchangeRate;
                        RowObj["FinalCurrency"] = CurItem.FinalCurrency.DisplayName;
                        RowObj["FinalAmount"] = CurItem.FinalAmount;
                        RowObj["ClaimHeaderID"] = CurItem.AttachedToClaimHeaderID;

                        if (CurItem.AttahcedToClaimHeader != null)
                        {
                            RowObj["ClaimHeaderReason"] = CurItem.AttahcedToClaimHeader.Reasons;
                            RowObj["ClaimHeaderCreatedOn"] = CurItem.AttahcedToClaimHeader.CreatedOn;
                            RowObj["ClaimHeaderCreatedInString"] = SwissArmy.DateConvert(CurItem.AttahcedToClaimHeader.CreatedOn, this.CurrentPrivateSession.DateFormatInUse, "/");
                        }

                        this.ResultTable.Rows.Add(RowObj);
                    }
                }
                else
                {
                    this.CurLogManager.LogError("[GonzalesCCImport.LoadData] : Faile to get Actual Card Items : " + CurCreditCardManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);
                }

            }
        }
        else
        {
            // redirect to error page
        }
    }

    #endregion    

    #region SaveDataAndTransferData
    protected bool SaveDataAndTransferData()
    {
        bool smooth = true;

        using (CreditCardManager CurCreditCardManager = new CreditCardManager(this.CurrentPrivateSession))
        {
            CreditCardItems CurCreditCardItems = CurCreditCardManager.GetAvailableItemsByEmployee(this.CurrentPrivateSession.CurrentLoggedOnUser.EmployeeID);

            if (CurCreditCardItems != null)
            {
                for (int x = 1; x < this.Table_CreditCardGrid.Rows.Count; x++)
                {
                    // check if checkbox is there
                    if (this.Table_CreditCardGrid.Rows[x].Cells[0].Controls.Count > 0)
                    {
                        CheckBox CheckBoxSelected = (CheckBox)this.Table_CreditCardGrid.Rows[x].Cells[0].Controls[0];
                        string ItemID = CheckBoxSelected.ID.Substring(0, 36);

                        for (int y = 0; y < CurCreditCardItems.Count; y++)
                        {
                            if (CurCreditCardItems[y].InternalID.CompareTo(ItemID) == 0)
                            {
                                CurCreditCardItems[y].IsSelected = CheckBoxSelected.Checked;
                                break;
                            }
                        }   // end for y
                    }
                    else
                    {
                        for (int y = 0; y < CurCreditCardItems.Count; y++)
                        {
                            if (CurCreditCardItems[y].InternalID.CompareTo(this.Table_CreditCardGrid.Rows[x].ID) == 0)
                            {
                                // remove this from the list, coz it is selected by others, and valid.
                                CurCreditCardItems.Remove(CurCreditCardItems[y]);
                                break;
                            }
                        }   // end for y
                    }
                }   // end for x

                
                if (!(smooth = CurCreditCardManager.UpdateActualItems(CurCreditCardItems, this.ClaimInternalID)))
                {
                    // log error message
                    this.CurLogManager.LogError("[GonzalesCCImport.SaveDataAndTransferData] : Failed to Update Actual Card Items : " + CurCreditCardManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);
                    this.ShowErrorMessage("[GonzalesCCImport.SaveDataAndTransferData] : Failed to Update Actual Card Items : " + CurCreditCardManager.ErrorMessage);
                }
                
            }
            else
            {
                // log error message
                this.CurLogManager.LogError("[GonzalesCCImport.SaveDataAndTransferData] : Faile to get Actual Card Items : " + CurCreditCardManager.ErrorMessage, this.CurrentPrivateSession.CurrentLoggedOnUser, LogInterface.User);
                this.ShowErrorMessage("[GonzalesCCImport.SaveDataAndTransferData] : Failed to get Actual Card Items : " + CurCreditCardManager.ErrorMessage);
            }
        }

        return smooth;
    }
    #endregion

    #endregion


}
